<?php
/**
 * @package pmapi
 * @copyright Copyright (c)2014 Enrico Fagnoni
 * @license GNU General Public License version 3, or later
 *
 * @since 1.0.0
 */
 
defined('_JEXEC') or die;

if (!class_exists('HomepageView')) require(JPATH_COMPONENT.DS.'views'.DS.'homepage.php');

class PmapiViewUser extends HomepageView
{
    function display($tpl = null) 
    {
        $app =JFactory::getApplication();
        $id = $this->getId();
        if (is_null($id)) {
            $app->enqueueMessage(JText::_('ANONYMOUS_USER_MESSAGE'));
        } elseif ($id > 0) {
            $app->redirect('index.php?option=com_virtuemart&view=user&virtuemart_user_id='.$id); 
        } else {
            throw new Exception("Not Found",404);
        }
    }
}